package com.gzyj.jtt808.v2013.protocol.jtt1078;

import com.gzyj.jtt808.v2013.enums.BusinessDataType;
import io.netty.buffer.ByteBuf;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.gzyj.jtt808.v2013.Package;

import java.io.Serializable;

/**
 * @author lhj
 */
@Data
@ApiModel("音视频实时传输控制")
public class JTT808_0x9102 extends Package implements Serializable {
    @ApiModelProperty("逻辑通道号")
    private Byte ChannelNo;
    @ApiModelProperty("控制指令")
    private Byte ControlCmd;
    @ApiModelProperty("关闭音视频类型")
    private Byte CloseAVData;
    @ApiModelProperty("切换码流类型")
    private Byte StreamType;


    public JTT808_0x9102(){
        super(BusinessDataType.音视频实时传输控制.getCode());
    }

    @Override
    public void encodeImpl(ByteBuf buf) {
        buf.writeByte(this.ChannelNo);
        buf.writeByte(this.ControlCmd);
        buf.writeByte(this.CloseAVData);
        buf.writeByte(this.StreamType);
    }

    @Override
    public JTT808_0x9102 decodeImpl(ByteBuf buf) {
        this.ChannelNo=buf.readByte();
        this.ControlCmd=buf.readByte();
        this.CloseAVData=buf.readByte();
        this.StreamType=buf.readByte();
        return this;
    }
}
